(function($){function initMouseDetection(disable){if(!mouseDetectionEnabled&&!disable){var firstTime=!0,lastMove=null;$(document).bind({"mousemove.smartmenus_mouse":function(e){var thisMove={x:e.pageX,y:e.pageY,timeStamp:(new Date).getTime()};if(lastMove){var deltaX=Math.abs(lastMove.x-thisMove.x),deltaY=Math.abs(lastMove.y-thisMove.y);if((deltaX>0||deltaY>0)&&deltaX<=2&&deltaY<=2&&thisMove.timeStamp-lastMove.timeStamp<=300){mouse=!0;if(firstTime){var $a=$(e.target).closest("a");$a.is("a")&&$.each(menuTrees,function(){if($.contains(this.$root[0],$a[0]))return this.itemEnter({currentTarget:$a[0]}),!1}),firstTime=!1}}}lastMove=thisMove},"touchstart.smartmenus_mouse pointerover.smartmenus_mouse MSPointerOver.smartmenus_mouse":function(e){/^(4|mouse|pen)$/.test(e.originalEvent.pointerType)||(mouse=!1)}}),mouseDetectionEnabled=!0}else mouseDetectionEnabled&&disable&&($(document).unbind(".smartmenus_mouse"),mouseDetectionEnabled=!1)}var menuTrees=[],IE=!!window.createPopup,IElt9=IE&&!document.defaultView,IElt8=IE&&!document.querySelector,IE6=IE&&typeof document.documentElement.currentStyle.minWidth=="undefined",mouse=!1,mouseDetectionEnabled=!1;$.SmartMenus=function(elm,options){this.$root=$(elm),this.opts=options,this.rootId="",this.$subArrow=null,this.subMenus=[],this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.zIndexInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.lastLevel=0,this.init()},$.extend($.SmartMenus,{hideAll:function(){$.each(menuTrees,function(){this.menuHideAll()})},destroy:function(){while(menuTrees.length)menuTrees[0].destroy();initMouseDetection(!0)},prototype:{init:function(refresh){var self=this;if(!refresh){menuTrees.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0),this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).bind({"mouseover.smartmenus":$.proxy(this.rootOver,this),"mouseout.smartmenus":$.proxy(this.rootOut,this)}).delegate("a, div.logo-container",{"mouseenter.smartmenus":$.proxy(this.itemEnter,this),"mouseleave.smartmenus":$.proxy(this.itemLeave,this),"mousedown.smartmenus":$.proxy(this.itemDown,this),"focus.smartmenus":$.proxy(this.itemFocus,this),"blur.smartmenus":$.proxy(this.itemBlur,this),"click.smartmenus":$.proxy(this.itemClick,this),"touchend.smartmenus":$.proxy(this.itemTouchEnd,this)});var eNamespace=".smartmenus"+this.rootId;this.opts.hideOnClick&&$(document).on("touchstart"+eNamespace,$.proxy(this.docTouchStart,this)).on("touchmove"+eNamespace,$.proxy(this.docTouchMove,this)).on("touchend"+eNamespace,$.proxy(this.docTouchEnd,this)).on("click"+eNamespace,$.proxy(this.docClick,this)),$(window).on("resize"+eNamespace+" orientationchange"+eNamespace,$.proxy(this.winResize,this));var $vmenu=$("body.vmenu .vmenu-container");!$vmenu.length&&UNCODE.wwidth>UNCODE.mediaQuery&&$(window).on("scroll"+eNamespace+" orientationchange"+eNamespace,$.proxy(this.winResize,this)),this.opts.subIndicators&&(this.$subArrow=$("").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),initMouseDetection()}this.$firstSub=this.$root.find("ul:not(.nav-tabs):not(.unmenu-block):not(.unmenu-block *)").each(function(){self.menuInit($(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0);if(this.opts.markCurrentItem){var reDefaultDoc=/(index|default)\.[^#\?\/]*/i,reHash=/#.*/,locHref=window.location.href.replace(reDefaultDoc,""),locHrefNoHash=locHref.replace(reHash,"");this.$root.find("a").each(function(){var href=this.href.replace(reDefaultDoc,""),$this=$(this);if(href==locHref||href==locHrefNoHash)$this.addClass("current"),self.opts.markCurrentTree&&$this.parents("li").each(function(){var $this=$(this);$this.dataSM("sub")&&$this.children("a").addClass("current")})})}},destroy:function(){this.menuHideAll(),this.$root.removeData("smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").unbind(".smartmenus").undelegate(".smartmenus");var eNamespace=".smartmenus"+this.rootId;$(document).unbind(eNamespace),$(window).unbind(eNamespace),this.opts.subIndicators&&(this.$subArrow=null);var self=this;$.each(this.subMenus,function(){this.hasClass("mega-menu")&&this.find("ul:not(.nav-tabs):not(.unmenu-block):not(.unmenu-block *)").removeDataSM("in-mega");if(this.dataSM("shown-before")){IElt8&&this.children().css({styleFloat:"",width:""});if(self.opts.subMenusMinWidth||self.opts.subMenusMaxWidth)IE6?this.css({width:"",overflowX:"",overflowY:""}).children().children("a").css("white-space",""):this.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap");this.dataSM("scroll-arrows")&&this.dataSM("scroll-arrows").remove(),this.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})}self.opts.subIndicators&&this.dataSM("parent-a").removeClass("has-submenu").children("span.sub-arrow").remove(),this.removeDataSM("shown-before").removeDataSM("ie-shim").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").parent().removeDataSM("sub")}),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),menuTrees.splice($.inArray(this,menuTrees),1)},disable:function(noOverlay){if(!this.disabled){this.menuHideAll();if(!noOverlay&&!this.opts.isPopup&&this.$root.is(":visible")){var pos=this.$root.offset();this.$disableOverlay=$('
').css({position:"absolute",top:pos.top,left:pos.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex()+1,opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(e){(this.visibleSubMenus.length&&!$.contains(this.$root[0],e.target)||$(e.target).is("a:not([data-filter])"))&&this.menuHideAll($(e.target))},docTouchEnd:function(e){if(!this.lastTouch)return;if(this.visibleSubMenus.length&&(this.lastTouch.x2===undefined||this.lastTouch.x1==this.lastTouch.x2)&&(this.lastTouch.y2===undefined||this.lastTouch.y1==this.lastTouch.y2)&&(!this.lastTouch.target||!$.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var self=this;this.hideTimeout=setTimeout(function(){self.menuHideAll($(e.target))},350)}this.lastTouch=null},docTouchMove:function(e){if(!this.lastTouch)return;var touchPoint=e.originalEvent.touches[0];this.lastTouch.x2=touchPoint.pageX,this.lastTouch.y2=touchPoint.pageY},docTouchStart:function(e){var touchPoint=e.originalEvent.touches[0];this.lastTouch={x1:touchPoint.pageX,y1:touchPoint.pageY,target:touchPoint.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getHeight:function($elm){return this.getOffset($elm,!0)},getOffset:function($elm,height){var old,$win=$(window),winW=$win.width();$elm.css("display")=="none"&&(old={position:$elm[0].style.position,visibility:$elm[0].style.visibility},$elm.css({position:"absolute",visibility:"hidden"}).show(),($("body").hasClass("menu-mobile-off-canvas")&&winW<960&&$elm.closest(".main-menu-container").length||($("body").hasClass("vmenu-offcanvas-overlay")||$("body").hasClass("vmenu"))&&winW>=960&&$elm.closest(".main-menu-container").length&&!$elm.closest(".menu-horizontal-inner").length)&&$elm.closest("li").addClass("smartmenu-open-item"));var defaultView=$elm[0].ownerDocument.defaultView,compStyle=defaultView&&defaultView.getComputedStyle&&defaultView.getComputedStyle($elm[0],null),val=compStyle&&parseFloat(compStyle[height?"height":"width"]);return val?val+=parseFloat(compStyle[height?"paddingTop":"paddingLeft"])+parseFloat(compStyle[height?"paddingBottom":"paddingRight"])+parseInt(compStyle[height?"borderTopWidth":"borderLeftWidth"])+parseInt(compStyle[height?"borderBottomWidth":"borderRightWidth"]):val=height?$elm[0].offsetHeight:$elm[0].offsetWidth,old&&$elm.hide().css(old),val},getWidth:function($elm){return this.getOffset($elm)},getStartZIndex:function(){var zIndex=parseInt(this.$root.css("z-index"));return isNaN(zIndex)?1:zIndex},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function($a){return this.handleEvents()&&!this.isLinkInMegaMenu($a)},isCollapsible:function(){return this.$firstSub.css("position")=="static"},isCSSOn:function(){return this.$firstLink.css("display")=="block"||this.$firstLink.css("display")=="flex"||this.$firstLink.css("display")=="inline-flex"||this.$firstLink.css("display")=="table-cell"||this.$firstLink.css("display")=="inline"},isFixed:function(){return this.$root.css("position")=="fixed"},isLinkInMegaMenu:function($a){return!$a.parent().parent().dataSM("level")},isTouchMode:function(){return!mouse||this.isCollapsible()},itemActivate:function($a,$show){var $li=$a.parent(),$ul=$li.parent(),level=$ul.dataSM("level"),winh=$(window).height();if(level>1&&(!this.activatedItems[level-2]||this.activatedItems[level-2][0]!=$ul.dataSM("parent-a")[0])){var self=this;$($ul.parentsUntil("[data-smartmenus-id]","ul:not(.nav-tabs):not(.unmenu-block):not(.unmenu-block *)").get().reverse()).add($ul).each(function(){self.itemActivate($(this).dataSM("parent-a"))})}if(this.visibleSubMenus.length>level)for(var i=this.visibleSubMenus.length-1,l=!this.activatedItems[level-1]||this.activatedItems[level-1][0]!=$a[0]?level-1:level;i>l;i--){this.lastLevel=level;if(typeof $show=="undefined"&&this.isCollapsible()){this.menuHide(this.visibleSubMenus[i],$a);return}this.menuHide(this.visibleSubMenus[i])}this.activatedItems[level-1]=$a,this.visibleSubMenus[level-1]=$ul;if(this.$root.triggerHandler("activate.smapi",$a[0])===!1)return;var $sub=$li.dataSM("sub");if($sub&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)){var aRect=$a[0].getBoundingClientRect();(aRect.y<0||aRect.y>winh)&&this.isCollapsible()&&this.lastLevel===this.activatedItems.length&&setTimeout(function(){var currentScroll=$a.closest(".main-menu-container").scrollTop();$a.closest(".main-menu-container").scrollTop(currentScroll+aRect.y)},1),this.menuShow($sub)}},itemBlur:function(e){var $a=$(e.currentTarget);if(!this.handleItemEvents($a))return;this.$root.triggerHandler("blur.smapi",$a[0])},itemClick:function(e){var $a=$(e.currentTarget);if(!this.handleItemEvents($a))return;$a.removeDataSM("mousedown");if(this.$root.triggerHandler("click.smapi",$a[0])===!1)return!1;var $sub=$a.parent().dataSM("sub");if(this.isTouchMode()){$a.dataSM("href")&&$a.attr("href",$a.dataSM("href")).removeDataSM("href");if($sub&&(!$sub.dataSM("shown-before")||!$sub.is(":visible"))){this.itemActivate($a);if($sub.is(":visible"))return!1}}else if(this.opts.showOnClick&&$a.parent().parent().dataSM("level")==1&&$sub)return this.clickActivated=!0,this.menuShow($sub),!1;if($a.hasClass("disabled"))return!1;if(this.$root.triggerHandler("select.smapi",$a[0])===!1)return!1},itemDown:function(e){var $a=$(e.currentTarget);if(!this.handleItemEvents($a))return;$a.dataSM("mousedown",!0)},itemEnter:function(e){var $a=$(e.currentTarget);if(!this.handleItemEvents($a))return;if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var self=this;this.showTimeout=setTimeout(function(){self.itemActivate($a)},this.opts.showOnClick&&$a.parent().parent().dataSM("level")==1?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",$a[0])},itemFocus:function(e){var $a=$(e.currentTarget);if(!this.handleItemEvents($a))return;(!this.isTouchMode()||!$a.dataSM("mousedown"))&&(!this.activatedItems.length||this.activatedItems[this.activatedItems.length-1][0]!=$a[0])&&this.itemActivate($a),this.$root.triggerHandler("focus.smapi",$a[0])},itemLeave:function(e){var $a=$(e.currentTarget);if(!this.handleItemEvents($a))return;this.isTouchMode()||($a[0].blur&&$a[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),$a.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",$a[0])},itemTouchEnd:function(e){var $a=$(e.currentTarget);if(!this.handleItemEvents($a))return;var $sub=$a.parent().dataSM("sub");$a.attr("href").charAt(0)!=="#"&&$sub&&(!$sub.dataSM("shown-before")||!$sub.is(":visible"))&&($a.dataSM("href",$a.attr("href")),$a.attr("href","#"))},menuFixLayout:function($ul){$ul.dataSM("shown-before")||($ul.hide().dataSM("shown-before",!0),IElt8&&$ul.children().css({styleFloat:"left",width:"100%"}))},menuHide:function($sub,$show){if(this.$root.triggerHandler("beforehide.smapi",$sub[0])===!1)return;$sub.stop(!0,!0);if($sub.is(":visible")){var self=this,complete=function(){IElt9?$sub.parent().css("z-index",""):$sub.css("z-index",""),typeof $show!="undefined"&&self.itemActivate($show,!0)};this.isCollapsible()?this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,$sub,complete):$sub.hide(this.opts.collapsibleHideDuration,complete):this.opts.hideFunction?this.opts.hideFunction.call(this,$sub,complete):$sub.hide(this.opts.hideDuration,complete),$sub.dataSM("ie-shim")&&$sub.dataSM("ie-shim").remove(),$sub.dataSM("scroll")&&$sub.unbind(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide(),$sub.dataSM("parent-a").removeClass("highlighted");var level=$sub.dataSM("level");this.activatedItems.splice(level-1,1),this.visibleSubMenus.splice(level-1,1),this.$root.triggerHandler("hide.smapi",$sub[0])}},menuHideAll:function($item){if($item!=undefined&&$item.parent().hasClass("menu-item")&&!$item.parent().hasClass("menu-item-has-children"))return;var $win=$(window),winW=$win.width();this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var i=this.visibleSubMenus.length-1;i>0;i--)if(this.visibleSubMenus[i].closest(".smartmenu-open-item").length){if($item==undefined||!$item.closest(".smartmenu-open-item").length)return;this.menuHide(this.visibleSubMenus[i]),$(this.visibleSubMenus[i]).closest(".smartmenu-open-item").removeClass("smartmenu-open-item")}else this.menuHide(this.visibleSubMenus[i]);this.opts.isPopup&&(this.$root.stop(!0,!0),this.$root.is(":visible")&&(this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration),this.$root.dataSM("ie-shim")&&this.$root.dataSM("ie-shim").remove())),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.zIndexInc=0},menuIframeShim:function($ul){IE&&this.opts.overlapControlsInIE&&!$ul.dataSM("ie-shim")&&$ul.dataSM("ie-shim",$("